/**
 * 一张图store
 */
const useOnemapStore = defineStore("onemap", {
  state: () => ({
    // 当前选中的节点 省，市，区县，露天矿
    selectedNode: { level: 1 },
    // 当前露天矿
    currentOpenPitInfo: {},
    // 节点等级
    nodeLevel: 1,
  }),
  actions: {
    setNodeLevel(level) {
      this.nodeLevel = level;
    },
    setSelectedNode(node) {
      this.selectedNode = node;
      this.currentOpenPitInfo = {};
      this.nodeLevel = node.level;
    },
    setCurrentOpenPitInfo(info) {
      this.currentOpenPitInfo = info;
    },
  },
});

export default useOnemapStore;
